<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:replace="front-common :: commonCss(~{::title},~{},~{},~{::style})">
    <title>我的班级</title>
    <style type="text/css">
        .container{
            display: flex;
            justify-content: center;
            align-items: flex-start;
            border: #f8f8f8 30px solid;
            padding: 0;
        }
        .content{
            background-color: #ffffff;
            float: right;
            min-height: 75vh;
            width: 100%;
        }
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">

    <div th:replace="front-common::header('information')"></div>

    <div class="layui-layout-body" style="margin-top: 50px;background-color: #f8f8f8;">
        <div class="layui-container container">
            <div th:replace="front-common::infoSide('clazz')"></div>
            <div class="content">
                <div class="layui-fluid" >
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
                        <legend>个人信息</legend>
                    </fieldset>
                    <div class="layui-card">
                        <div class="layui-card-body">
                            <div style="padding-bottom:10px;">
                                <table class="layui-hide" id="applyTable" lay-skin="line" lay-filter="applyTable">
                                </table>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>

        <div th:replace="front-common::footer"></div>
    </div>

</div>
<script th:inline="javascript">
    layui.use(['laydate','table','form'], function() {
        var table = layui.table;
        var $ = layui.jquery;


        var tableIns = table.render({
            elem: '#applyTable'
            , url: '/apply/listForPage'
            , toolbar: '#toolbar'
            , contentType: 'application/json'
            , method: 'post'
            , where: {
                "msg": "",
                "code": "",
                "data": {}
            }
            , defaultToolbar: []
            , page: true
            , limits: [5, 10, 20]
            , limit: 10
            , cols: [
                [
                    {field: 'id', title: 'ID', hide: true}
                    , {field: 'teacherId', title: 'teacherId', hide: true}
                    , {field: 'teacherUsername', title: '教师用户名'}
                    , {field: 'teacherName', title: '教师姓名'}
                    , {field: 'clazzId', title: 'clazzId', hide: true}
                    , {field: 'clazzName', title: '班级名'}
                    , {field: 'type', title: '状态', templet: function (d) {
                        var type = d.type;
                        if(type===-1){
                            return '<span style="color:red;">已拒绝</span>';
                        }else if(type===1){
                            return '<span style="color:green;">已通过</span>';
                        }else{
                            return '<span>进行中</span>';
                        }
                    }}
                    , {field: 'applyTime', title: '申请时间'}
                    , {field: 'finishTime', title: '完成时间'}
                ]
            ]
            ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.result.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.records //解析数据列表
                };
            }
        });

    })
</script>
</body>

</html>